package com.kawaiior.asoulworld.property.Properties;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingHurtEvent;

public class PropertyPierce extends PropertyBase implements Iproperty {

    private int[] levelOfValue = new int[]{2,1,0};

    public PropertyPierce(int level) {
        super(level);
    }

    @Override
    public void doProperty(LivingHurtEvent event) {
        if (!(event.getSource().getTrueSource() instanceof EntityPlayer)) { return; }
        event.getSource().setDamageBypassesArmor();
        EntityPlayer player = (EntityPlayer)event.getSource().getTrueSource();
        player.getFoodStats().setFoodLevel(
                player.getFoodStats().getFoodLevel() < levelOfValue[this.getLevel()] ?
                        0 : player.getFoodStats().getFoodLevel()-levelOfValue[this.getLevel()]);
    }

    @Override
    public String getPropertyString() {
        return "property_pierce";
    }
}
